<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header('地点列表')"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								城市：
								<select id="cityid" name="cityid" style="width:150px;">
									<option value="">全部</option>
									<option th:each="city:${cities}"  th:value="${city.id}" th:text="${city.cityname}" value="1">
										aaa
									</option>
								</select>
							</li>
							<li>
								地点名称：<input type="text" name="placename"/>
							</li>

							<li>
								地点描述：<input type="text" name="placedesc"/>
							</li>
							<li>
								备注信息：<input type="text" name="remark"/>
							</li>
							<li>
								状态：
								<select id="delFlag" name="delFlag" style="width:150px;">
									<option value="">全部</option>
									<option value="0">正常</option>
									<option value="1">禁用</option>
								</select>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="fantasy:fantasyCitymap:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit" onclick="$.operate.edit()" shiro:hasPermission="fantasy:fantasyCitymap:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-warning btn-del btn-del" onclick="$.operate.disableAll()" shiro:hasPermission="fantasy:fantasyCities:disable">
					<i class="fa fa-minus"></i> 禁用
				</a>
				<a class="btn btn-warning btn-del btn-del" onclick="$.operate.restoreAll()" shiro:hasPermission="fantasy:fantasyCitymap:disable">
					<i class="fa fa-check"></i> 还原
				</a>
				<a class="btn btn-danger btn-del btn-del" onclick="$.operate.removeAll()" shiro:hasPermission="fantasy:fantasyCitymap:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('fantasy:fantasyCitymap:edit')}]];
        var removeFlag = [[${@permission.hasPermi('fantasy:fantasyCitymap:remove')}]];
        var disableFlag = [[${@permission.hasPermi('fantasy:fantasyCitymap:disable')}]];
        var addNpcPositionFlag = [[${@permission.hasPermi('fantasy:fantasyNpcPosition:disable')}]];
		var addShopFlag = [[${@permission.hasPermi('fantasy:fantasyShop:add')}]];
        var prefix = ctx + "fantasy/fantasyCitymap";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                disableUrl: prefix + "/disable",
                restoreUrl: prefix + "/restore",
				exportUrl: prefix + "/export",
                //npcUrl: prefix + "/npc/{id}",
                modalName: "城市地点",
				search: false,
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '地点id',
					visible: true,
                    sortable: true
				},
				{
					field : 'cityname',
					title : '所属城市',
                    sortable: true
				},
				{
					field : 'placename', 
					title : '地点名称',
					sortable: true
				},
				{
					field : 'placedesc', 
					title : '地点描述',
					sortable: true
				},
				{
					field : 'updateBy',
					title : '更新者',
					sortable: true
				},
				{
					field : 'updateTime',
					title : '更新时间',
					sortable: true
				},
				{
					field : 'remark',
					title : '备注信息',
					sortable: true
				},
				{
					field : 'delFlag',
					title : '状态',
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
					width:150,
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-warning btn-xs ' + disableFlag + '" href="#" onclick="$.operate.disable(\'' + row.id + '\')"><i class="fa fa-minus"></i>禁用</a> ');
                        actions.push('<a class="btn btn-warning btn-xs ' + disableFlag + '" href="#" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-check"></i>还原</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + addNpcPositionFlag + '" href="#" onclick="allocNpc(\'' + row.id + '\')"><i class="fa fa-edit"></i>Npc</a> ');
						actions.push('<a class="btn btn-success btn-xs ' + addShopFlag + '" href="#" onclick="allocShop(\'' + row.id + '\')"><i class="fa fa-edit"></i>商店</a> ');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });

        // 地图节点管理-分配Npc
        function allocNpc(id) {
            var url = prefix + '/allocNpc/' + id;
            $.modal.openTab("分配Npc", url);
        }
		// 地图节点管理-分配商店
		function allocShop(id) {
			var url = prefix + '/allocShop/' + id;
			$.modal.openTab("分配商店", url);
		}
    </script>
</body>
</html>